Test your skills through the online practice test: EJB Quiz Online Practice Test

Related differences

EJB 1.0 vs EJB 2.0EJB 2.0 vs EJB 3.0EJB 3.0 vs Spring
JavaBeans vs EJB

Ques 21. Can I invoke Runtime.gc() in an EJB?

You shouldn’t. What will happen depends on the implementation, but the call will most likely be ignored.

Is it helpful? Add Comment View Comments
 

Ques 22. What are the different kinds of enterprise beans?

Stateless session bean- An instance of these non-persistent EJBs provides a service without storing an interaction or conversation state between methods. Any instance can be used for any client.

Stateful session bean- An instance of these non-persistent EJBs maintains state across methods and transactions. Each instance is associated with a particular client.

Entity bean- An instance of these persistent EJBs represents an object view of the data, usually rows in a database. They have a primary key as a unique identifier. Entity bean persistence can be either container-managed or bean-managed.

Message-driven bean- An instance of these EJBs is integrated with the Java Message Service (JMS) to provide the ability for message-driven beans to act as a standard JMS message consumer and perform asynchronous processing between the server and the JMS message producer.

Is it helpful? Add Comment View Comments
 

Ques 23. What is Remote client view?

The remote client view specification is only available in EJB 2.0. The remote client view of an enterprise bean is location independent. A client running in the same JVM as a bean instance uses the same API to access the bean as a client running in a different JVM on the same or different machine.
Remote interface: The remote interface specifies the remote business methods that a client can call on an enterprise bean.
Remote home interface: The remote home interface specifies the methods used by remote clients for locating, creating, and removing instances of enterprise bean classes.

Is it helpful? Add Comment View Comments
 

Ques 24. What is Local client view?

The local client view specification is only available in EJB 2.0. Unlike the remote client view, the local client view of a bean is location dependent. Local client view access to an enterprise bean requires both the local client and the enterprise bean that provides the local client view to be in the same JVM. The local client view therefore does not provide the location transparency provided by the remote client view. Local interfaces and local home interfaces provide support for lightweight access from enterprise bean that are local clients. Session and entity beans can be tightly couple with their clients, allowing access without the overhead typically associated with remote method calls.

Is it helpful? Add Comment View Comments
 

Ques 25. What is EJB client JAR file?

An EJB client JAR file is an optional JAR file that can contain all the class files that a client program needs to use the client view of the enterprise beans that are contained in the EJB JAR file. If you decide not to create a client JAR file for an EJB module, all of the client interface classes will be in the EJB JAR file.

Is it helpful? Add Comment View Comments
 

Most helpful rated by users: